home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / gs24src.zip / GXMATRIX.H < prev    next >
C/C++ Source or Header  |  1992-03-24  |  2KB  |  56 lines

  1. /* Copyright (C) 1989, 1990 Aladdin Enterprises.  All rights reserved.
  2.    Distributed by Free Software Foundation, Inc.
  3.  
  4. This file is part of Ghostscript.
  5.  
  6. Ghostscript is distributed in the hope that it will be useful, but
  7. WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  8. to anyone for the consequences of using it or for whether it serves any
  9. particular purpose or works at all, unless he says so in writing.  Refer
  10. to the Ghostscript General Public License for full details.
  11.  
  12. Everyone is granted permission to copy, modify and redistribute
  13. Ghostscript, but only under the conditions described in the Ghostscript
  14. General Public License.  A copy of this license is supposed to have been
  15. given to you along with Ghostscript so you can know your rights and
  16. responsibilities.  It should be in a file named COPYING.  Among other
  17. things, the copyright notice and this notice must be preserved on all
  18. copies.  */
  19.  
  20. /* gxmatrix.h */
  21. /* Internal matrix routines for Ghostscript library */
  22. #include "gsmatrix.h"
  23.  
  24. /* A matrix with a cached fixed-point copy of the translation. */
  25. /* This is only used by a few routines; they are responsible */
  26. /* for ensuring the validity of the cache */
  27. /* (by calling gs_update_matrix_fixed). */
  28. typedef struct gs_matrix_fixed_s {
  29.     _matrix_body;
  30.     fixed tx_fixed, ty_fixed;
  31. } gs_matrix_fixed;
  32. extern    void    gs_update_matrix_fixed(P1(gs_matrix_fixed *));
  33.  
  34. /* Coordinate transformations to fixed point */
  35. int    gs_point_transform2fixed(P4(gs_matrix_fixed *, floatp, floatp, gs_fixed_point *)),
  36.     gs_distance_transform2fixed(P4(gs_matrix_fixed *, floatp, floatp, gs_fixed_point *));
  37.  
  38. /* Macro for testing whether matrix coefficients are zero, */
  39. /* for shortcuts when the matrix has no skew. */
  40. #define is_skewed(pmat) !is_fzero2((pmat)->xy, (pmat)->yx)
  41.  
  42. /* Define the fixed-point coefficient structure for avoiding */
  43. /* floating point in coordinate transformations. */
  44. /* Currently this is used only by the Type 1 font interpreter. */
  45. typedef struct {
  46.     long xx, xy, yx, yy;
  47.     int skewed;
  48.     int shift;            /* see c_fixed */
  49.     int max_bits;            /* max bits of coefficient */
  50.     fixed round;            /* ditto */
  51. } fixed_coeff;
  52. /* Multiply an integer not exceeding max_bits in magnitude */
  53. /* by a coefficient from a fixed_coeff. */
  54. #define m_fixed(iv, c, fc)\
  55.   arith_rshift((iv) * (c) + (fc).round, (fc).shift)
  56.